package com.youlai.boot.factory.model.form;

import java.io.Serial;
import java.io.Serializable;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;

import java.time.LocalDate;
import java.time.LocalDateTime;
import com.fasterxml.jackson.annotation.JsonFormat;
import jakarta.validation.constraints.*;

/**
 * 服装厂用户表单对象
 *
 * @author youlaitech
 * @since 2025-07-14 19:43
 */
@Getter
@Setter
@Schema(description = "服装厂用户表单对象")
public class UsersForm implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    @NotNull(message = "不能为空")
    private Integer userId;

    @Schema(description = "所属服装厂ID，关联到工厂表")
    @NotNull(message = "所属服装厂ID，关联到工厂表不能为空")
    private Integer factoryId;

    @Schema(description = "用户名，用于登录")
    @NotBlank(message = "用户名，用于登录不能为空")
    @Size(max=50, message="用户名，用于登录长度不能超过50个字符")
    private String username;

    @Schema(description = "加密后的密码")
    @NotBlank(message = "加密后的密码不能为空")
    @Size(max=255, message="加密后的密码长度不能超过255个字符")
    private String passwordHash;

    @Schema(description = "真实姓名")
    @NotBlank(message = "真实姓名不能为空")
    @Size(max=50, message="真实姓名长度不能超过50个字符")
    private String realName;

    @Schema(description = "联系电话")
    @Size(max=20, message="联系电话长度不能超过20个字符")
    private String phone;

    @Schema(description = "电子邮箱")
    @Size(max=100, message="电子邮箱长度不能超过100个字符")
    private String email;

    @Schema(description = "用户角色：worker-普通员工, supervisor-组长/主管, manager-厂长, admin-系统管理员")
    @NotNull(message = "用户角色：worker-普通员工, supervisor-组长/主管, manager-厂长, admin-系统管理员不能为空")
    @Size(max=10, message="用户角色：worker-普通员工, supervisor-组长/主管, manager-厂长, admin-系统管理员长度不能超过10个字符")
    private String  role;

    @Schema(description = "所属部门，如裁剪部、缝制部、包装部等")
    @Size(max=50, message="所属部门，如裁剪部、缝制部、包装部等长度不能超过50个字符")
    private String department;

    @Schema(description = "职位")
    @Size(max=50, message="职位长度不能超过50个字符")
    private String position;

    @Schema(description = "入职日期")
    private LocalDate hireDate;

    @Schema(description = "账号状态：0-禁用，1-启用")
    private Integer status;

    @Schema(description = "登录时ip所在地")
    @Size(max=255, message="登录时ip所在地长度不能超过255个字符")
    private String loginIpAddress;

    @Schema(description = "登录时ip ")
    @Size(max=255, message="登录时ip 长度不能超过255个字符")
    private String loginIp;

    @Schema(description = "最后登录时间")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime lastLogin;

    @Schema(description = "创建时间")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createdAt;

    @Schema(description = "更新时间")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updatedAt;

    @Schema(description = "创建人ID")
    private Integer createdBy;

    @Schema(description = "备注信息")
    @Size(max=65535, message="备注信息长度不能超过65535个字符")
    private String notes;


}
